<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserBalanceLogTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_balance_log', function (Blueprint $table) {
            $table->increments('log_id')->comment('主键ID');
            $table->unsignedInteger('user_id')->default(0)->index('user_id')->comment('用户ID');
            $table->unsignedTinyInteger('scene')->default(10)->comment('余额变动场景(10用户充值 20用户消费 30管理员操作 40订单退款)');
            $table->decimal('money', 10)->default(0.00)->comment('变动金额');
            $table->string('describe', 500)->default('')->comment('描述/说明');
            $table->string('remark', 500)->default('')->comment('管理员备注');
            $table->unsignedInteger('store_id')->default(0)->index('store_id')->comment('小程序商城ID');
            $table->unsignedInteger('create_time')->default(0)->comment('创建时间');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_balance_log');
    }
}
